import dayjs from 'dayjs'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import relativeTime from 'dayjs/plugin/relativeTime'
import localizedFormat from 'dayjs/plugin/localizedFormat'
import 'dayjs/locale/zh-cn'
import type { Plugin } from 'vue'

export const dayjsPlugin: Plugin = {
  install: () => {
    dayjs.extend(customParseFormat)
    dayjs.extend(relativeTime)
    dayjs.extend(localizedFormat)
    dayjs.locale('zh-cn')
  },
}
